#ifndef COMMAND_H
#define COMMAND_H
#include <QString>
#include <iostream>
#include <QPixmap>

//在命名空间YCN下
//自定义通信协议，取名为命令
//命令=命令类型+数据体
namespace  YCN{

    struct Command
    {

        struct RadioData
        {
            public:
                //构造函数初始化列表
                RadioData( QString name,QString id,QString role,std::shared_ptr<QPixmap>pix_map):name_(name),id_(id),role_(role)
                  ,pix_map_(pix_map)
                {
                }
                virtual ~RadioData(){};
                //展示内联函数的使用，operator关键字重载=号
                //这是浅拷贝
                inline std::shared_ptr<RadioData> operator=(const std::shared_ptr<RadioData> &radio_data)
                {
                    this-> name_=radio_data->name_;
                    this-> id_=radio_data->id_;
                    this-> role_=radio_data->role_;
                    this-> pix_map_=radio_data->pix_map_;
                }

            public:
                QString name_;
                QString id_;
                QString role_;
                std::shared_ptr<QPixmap>pix_map_;
            };

    public:
    explicit Command(QString cmdType,const RadioData &radioData):cmdType(cmdType),radioData(radioData){}
            ~Command(){}

    public:
        QString cmdType;
        RadioData radioData;

    };

};

#endif // COMMAND_H
